/**
 * Created by baiguiren on 1/16/17.
 */

const async = require('async');

const test_arr = [1,2,3, 4, 5];

async.reduce(test_arr, 0, function (memo, item, callback) {
    console.log('current item: ' + item);
    callback(null, memo + item);
}, function (err, results) {
    console.log(results);
});

async.reduceRight(test_arr, 0, function (memo, item, callback) {
    console.log('current item: ' + item);
    callback(null, memo + item);
}, function (err, results) {
    console.log(results);
});

